<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!-- 取出部署的应用程序名或者是当前的项目名称 -->
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<!DOCTYPE html>
<html lang="zh-CN" class="no-js">
<head>
  <meta charset="UTF-8">
  <title>个人信息</title>

  <%@include file="/WEB-INF/jsp/common/component/head.jsp"%>
</head>

<body>
<%@include file="/WEB-INF/jsp/common/component/navbar.jsp"%>

<div id="left">
  <%@include file="/WEB-INF/jsp/common/component/userMessage.jsp"%>
  <%@include file="/WEB-INF/jsp/common/component/menu.jsp"%>
</div><!-- /#left -->

<div id="wrap">
  <div class="content" >
    <div class="inner">
      <form id="updateForm" class="form-horizontal" role="form">
        <div class="form-group">                                                                               <!--页头-->
          <div class="col-sm-12 ">
            <div class="page-header">
              <h1>&nbsp;&nbsp;&nbsp;修&nbsp;改&nbsp;信&nbsp;息</h1>
            </div>
          </div>
        </div>
        <div class="form-group">                                                                            <!--上传书籍图片-->
          <label for="avatar" class="col-sm-4 control-label">用户头像</label>
          <div class="col-sm-3 ">
            <input id="avatar" name="avatar" type="file">
          </div>
          <%--<div class="col-sm-1">--%>
            <%--<label>--%>
              <%--<span class="label label-danger" >*</span>--%>
            <%--</label>--%>
          <%--</div>--%>
          <div class="col-sm-1">
            <label>
              <span class="label label-warning" ></span>
            </label>
          </div>
        </div>
        <br/>
        <br/>

        <div class="form-group">
          <label for="sex" class="col-sm-4 control-label">性别</label>
          <div class="col-sm-4" id="sex">
            <label class="radio-inline">
              <input type="radio" name="sex" value="1"> 男
            </label>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            <label class="radio-inline">
              <input type="radio" name="sex" value="0"> 女
            </label>
          </div>
          <%--<div class="col-sm-1">--%>
            <%--<label>--%>
              <%--<span class="label label-danger" >*</span>--%>
            <%--</label>--%>
          <%--</div>--%>
          <div class="col-sm-1">
            <label>
              <span class="label label-warning" ></span>
            </label>
          </div>
        </div>
        <br/>
        <div class="form-group">
          <label for="tel" class="col-sm-4 control-label">联系电话</label>
          <div class=" col-sm-3">
            <input type="tel" class="form-control" id="tel" name="tel" >
          </div>
          <%--<div class="col-sm-1">--%>
            <%--<label>--%>
              <%--<span class="label label-danger" >*</span>--%>
            <%--</label>--%>
          <%--</div>--%>
          <div class="col-sm-1">
            <label>
              <span class="label label-warning" ></span>
            </label>
          </div>
        </div>
        <br/>
        <div class="form-group">
          <label for="address" class="col-sm-4 control-label">联系地址</label>
          <div class=" col-sm-3">
            <input type="text" class="form-control" id="address" name="address">
          </div>
          <%--<div class="col-sm-1">--%>
            <%--<label>--%>
              <%--<span class="label label-danger" >*</span>--%>
            <%--</label>--%>
          <%--</div>--%>
          <div class="col-sm-1">
            <label>
              <span class="label label-warning" ></span>
            </label>
          </div>
        </div>
        <br/>
        <br/>
        <div class="form-group">
          <div class="col-sm-offset-4 col-sm-3">
            <!-- btn-block 指定按钮和父元素一样大 -->
            <button type="submit" class="btn btn-info btn-lg">修改</button>
            <button type="button" class="btn btn-info btn-lg col-sm-offset-3" onclick="window.history.back()">返回</button>
          </div>
        </div>
      </form>
      <br/>
      <br/>
    </div>
  </div><!-- /#content -->
  <%@include file="/WEB-INF/jsp/common/component/footer.jsp"%>
</div><!-- /#wrap -->
<%@include file="/WEB-INF/jsp/common/component/foot.jsp"%>

<script src="${ctx}/assets/js/user/profile/update.js"></script>
<script>
    $(document).ready(function(){
        <c:if test="${profile != null}">
        $("input[name=sex][value=" + ${profile.sex} + "]").attr("checked",'checked');
        $("#tel").val(${profile.tel});
        $("#address").val('${profile.address}');
        </c:if>

        initFileInput({
            ctrlName: "avatar",
            initialPreview: ['${profile.avatar}']
        });
    });
</script>
</body>

</html>